package com.yst.gateway.monitor.common.utils;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.support.RequestContext;

/**
 * 配置信息处理类
 * @author sheungxin
 *
 */
public class MessageUtils {
	
	/**
	 * 根据属性code，获取配置文件中的属性值
	 * @param code
	 * @return
	 */
	public static String  getMessage(String code){
		HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
		RequestContext requestContext=new RequestContext(request);
		return requestContext.getMessage(code);
	}

}
